import axios from 'axios'

const state ={
  cinameList:[],

}

const actions ={

  getcinameList({commit}){
    /*
    * 请求后端电影院列表
    * 前端组件名：cinemalist.vue
    * 何财宇负责*/
    axios.get('/api/cinema/allCinemas')

      .then((resp)=>{
        console.log(resp);
        const movieList = resp.data
        //console.log(movieList);
        commit('storeMovies',movieList)

      },(error)=>{
        console.error(error);
      })
  }
}

const mutations ={
  storeMovies(state,movieList){
   state.cinameList = movieList
    //console.log(state.movieList);
  }
}

const getters ={
  backcinemaList(state){
    return state.cinameList
  },

}

export default {
  state,
  actions,
  mutations,
  getters
}
